package org.example.weboj.controller;

import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * AI流式聊天控制器
 */
@RestController
@RequestMapping("/ai/stream")
public class AIStreamChatController {

    private static final Logger logger = LoggerFactory.getLogger(AIStreamChatController.class);

    /**
     * 健康检查端点
     */
    @GetMapping("/health")
    public ResponseEntity<String> health() {
        return ResponseEntity.ok("AI流式聊天服务正常运行");
    }

    /**
     * 流式聊天信息端点
     */
    @GetMapping("/info")
    public ResponseEntity<Object> getChatInfo() {
        return ResponseEntity.ok(
            Map.of(
                "description", "流式AI聊天API",
                "websocketEndpoint", "/ai/stream-chat",
                "supportedFeatures", new String[]{"代码补全", "错误修复", "问答"},
                "requestFormat", Map.of(
                    "message", "用户问题",
                    "code", "代码片段（可选）",
                    "errorMessage", "错误信息（可选）",
                    "language", "编程语言（可选）"
                ),
                "status", "online"
            )
        );
    }
}